<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${ctx}/css/sapar.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<script type="text/javascript" src="${ctx}/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/js/sapar.js"></script>
<script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
<script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/js/kkpager.min.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/css/kkpager_blue.css" />
<title>一次品档案</title>
<style>

#shushu{


color:red;
font-weight:bold;
}
</style>
</head>

<body>
    <div id="saper-container">
        <div id="saper-hd"></div>
        <div id="saper-bd">
            <div class="subfiled clearfix">
                <h2>数量修改</h2>
            </div>
            <div class="subfiled-content">
                <div class="search-box clearfix">
                    <div class="kv-item clearfix">
                        <label>器械数量：</label>
                        <div class="kv-item-content">
                            <input type="text" name="searchTxt" placeholder="修改数量" id ="num" class="search_text" onkeyup="this.value=this.value.replace(/\D/g,'')" >
                        </div>
                    </div>
                    <a href="javascript:;" class="sapar-btn sapar-btn-recom query-btn" onclick="do_save()">修改</a>
                </div>
                

                <!--表格开始-->
                <div class="table">
                    <!--表格操作-->
                    <div class="subfiled clearfix">
		                <h2>器械信息</h2>
		            </div>
                    <!--表格具体内容-->
                    <div class="table-box">
                        <table>
                            <thead>
                                <tr>                                
                                 <th class="text-left">器械名称</th>
								  <th class="text-left">所属包编号</th>  
			                      <th class="text-left">器械编号</th>
			    				  <th class="text-left">器械数量</th>
			    				  <th class="text-left">器械价格</th>
			    				  <th class="text-left">物品功能</th>
			    				    

                                </tr>
                            </thead>
                            <tbody>
                            	 <tr>
                            	 <c:if test="${ulist != null}">
                            	 <c:forEach items="${ulist}" var="qixie">
                                  	<td>${qixie.productName}</td>
                                  	<td>${qixie.packageId}</td>
                                 	<td>${qixie.productId}</td>
									<td>${qixie.num}</td>
									<td>${qixie.price}</td>
									<td>${qixie.function}</td>
									<input type="hidden" value="${qixie.productId}" id="productId">
									<input type="hidden" value="${qixie.packageId}" id="packageId">
			    				  </c:forEach>
			    				  </c:if>
                                </tr>
                            	
                            
                                
                            </tbody>
                        </table>
                    </div>
                </div><!--表格结束-->
            </div>
        </div>
        <div id="saper-ft">
       	 	<div id="kkpager"></div>
        </div>
    </div>
    
</body>

<script type="text/javascript">
//异步修改   并且回调
function do_save(){
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
 	var num = $("#num").val();
	var packageid = $("#packageId").val();
	var productId = $("#productId").val();
	$.ajax({
        type: "POST",
        url:"${ctx}/shoushumuban/shoushuqixieUpdateNum.do?packageid="+packageid+"&productId="+productId+"&num="+num,
        error: function(request) {
       	 	layer.alert("网络故障，请稍后再试!");
        },
        success: function(data) {
        	if(data.status=="true"){
        		layer.alert("修改成功",function(){
        			var map ={
    		 	   			"packageId":packageid,
    		 	   			"productId":productId,
    		 	   			"num":num
    		 	   		};
    		 	   	  parent.callbackData2(map);
    		 	   	  parent.layer.close(index);
        		});
        		
        	}else{
        		layer.msg(data.msg);
        	}
        		
        }
    });
}
</script>
</html>